#ifndef GRITC_SERVER_MOBILE_HPP
#define GRITC_SERVER_MOBILE_HPP

#include <gritc/server/actor.hpp>
#include <set>

namespace gritc { namespace server { 

	template<class Traits> struct mobile : actor<Traits>
	{
		typedef typename Traits::string_type string_type;
		typedef typename Traits::room_type room_type;

		typedef unsigned long ulong;

		ulong 	power			// damage/healing
			,	endurance		// hp/hp regen
			,	haste			// movement/cast/gcd/auto-attacks/dot/hot
			,	vitality		// energy/energy regen
			,	grace			// crit/procs chance
			,	gcd				// global cooldown
			,	soak			// damage soak
			,	hp;				// hitpoints

		typedef std::set<string_type> command_set;
		command_set commands_;
		command_set & commands() { return commands_; }

		mobile<Traits> * target_;
		mobile<Traits> & target() { return *target_; }
		void target(mobile<Traits> & t) { target_ = &t; }

		room_type * room_;
		room_type & room() { return *room_; }
		void room(room_type & r) { room_ = &r; }

		mobile(string_type const& n) 
			:	actor<Traits>(n)
			,	target_(NULL)
			,	room_(NULL)
			,	power(1)
			,	endurance(1)
			,	haste(1)
			,	vitality(1)
			,	grace(1)
			,	gcd(1500)
			,	soak(0) 
			,	hp(1) {}

		virtual ~mobile(){}

		virtual void respond(string_type const&) = 0;
	};

	template<class Traits> struct npc : mobile<Traits>
	{
		npc(string_type const& n) : mobile<Traits>(n) {}
		virtual ~npc() {}

		virtual void respond(string_type const&) {}
	};

	template<class Traits> struct player : mobile<Traits>
	{
		typedef typename Traits::string_type string_type;

		string_type response_;
		string_type & response() { return response_; }

		player(string_type const& n) : mobile<Traits>(n) {}
		virtual ~player() {}

		virtual void respond(string_type const& str)
		{
			response_.append(str);
		}
	};
}}

#endif